<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns:amfc>
<head>
<title>Programs</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<?IMPORT namespace="amfc" implementation="/include/htc/datagrid.htc">
<script src="/include/common.js"></script>
<script src="/include/soap.js"></script>
<script src="/include/RDS.js"></script>
<script src="/include/XML.js"></script>
</head>
<body style="background-color:menu;" bottommargin="0" topmargin="0" leftmargin="0" rightmargin="0" scroll="no" onload="window.focus()">
<table height="100%" width="100%">
	<tr height="80%">
		<td>
			<amfc:htcDatagrid id="dtgBrokers" caption="Brokers" allowEdit="true" allowAdd="true" allowDelete="true"
							style="height:100%;overflow-x:visible"
							hiddenFields="id"
							onFilter="filterRecords(this)"
							onDelete="deleteRecord('Bank_Delete')"
							onEdit="editRecord('Bank_Update')"
							onAdd="addRecord('Bank_Add')"
							onrowselected="selectRecord()"
			>
					<RS>
						<asp:Literal ID="ltrRS" Runat="server"></asp:Literal>
					</RS>
			</amfc:htcDatagrid>
		</td>
	</TR>
</table>
</body>
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</html>
<script>
initWS("GLRULES","GLRules.asmx");
var returnObject = {};
returnValue = returnObject;
function selectRecord(){
	returnObject.selectedID = _getID();
}
function deleteRecord(webMethod){
	var rs = event.rs;
	if( !checkWS() || !confirm("Delete "+rs("Name")+"?") )event.returnValue = false;
	var ret = WS(CO(webMethod),_getID());
	returnObject.deletedID = _getID();
	if(showSOAPError(ret)) return event.returnValue = false;
}
function editRecord(webMethod){
	if(!checkWS()) event.returnValue = false;
	var ret = WS(CO(webMethod),_getID(),event.fieldName,event.fieldValue);
	if(showSOAPError(ret)) return event.returnValue = false;
}
function addRecord(webMethod){
	if(!checkWS()) return event.returnValue = false;
	var rs = event.rs;
	var ret = WS(CO(webMethod),getDSFromRS(rs,"xmlProgram"));
	if( showSOAPError(ret) )return event.returnValue = false;
	var id = returnObject.addedID = _getID(ret.value);
	if( rs.Filter )rs.Filter += " OR "+rs(0).Name+"="+id;
	return;//============================================
	var filter = (event.rs.Filter?"("+event.rs.Filter+") OR ":"") + (rs(0).Name +" = "+id);
	var strRS = getRecordList(filter);
	if( strRS === false )return;
	dtgBrokers.setRecordset(strRS,filter);
}
function filterRecords(select){
	if(!checkWS()) return event.returnValue = false;
	var filter = (event.rs.filter||"").replace(/[*]/g,"%");
	var strRS = getRecordList(filter);
	if( strRS === false )return event.returnValue = false;
	event.returnValue = select.setRecordset(strRS);
}
function getRecordList(filter){
	if( !checkWS() )return false;
	var ret = WS(CO("ProgramList"),(filter||""));
	if( showSOAPError(ret) )return false;
	return ret.value;
}
// **** Properties *****
function _getID(id){
	if( arguments.length )event.rs("ID").value = id;
	return event.rs("ID").value;
}
function _brokerID(){ return dtgBrokers.recordset.Fields("ID").Value } 
function _brokerName(){ return dtgBrokers.recordset.Fields("Name").Value } 
</script>
